#include <stdio.h>
#include <stdlib.h>
#include "linkstack.h"
#include <assert.h>

int main() {
    linkstack_t *top;
    CreateEpLinkStack(&top);

    // 测试PushLinkStack
    PushLinkStack(&top, 1);
    PushLinkStack(&top, 2);
    PushLinkStack(&top, 3);
    assert(top->data == 3);
    assert(top->next->data == 2);
    assert(top->next->next->data == 1);

    // 测试IsEpLinkStack
    assert(IsEpLinkStack(top) == 1);

    // 测试GetTopLinkStack
    assert(GetTopLinkStack(top) == 3);

    // 测试PopLinkStack
    PopLinkStack(&top);
    assert(GetTopLinkStack(top) == 2);

    // 测试LengthLinkStack
    assert(LengthLinkStack(top) == 2);

    // 测试ClearLinkStack
    ClearLinkStack(&top);
    assert(IsEpLinkStack(top) == 0);

    printf("所有测试通过！\n");

    return 0;
}
